package com.soda.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.soda.service.StudentService;
import com.soda.service.impl.StudentServiceImpl;

public class DeleteStudentHoutaiServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		/**
		 * 后台删除学生（假删）
		 */
		response.setContentType("text/html;charset=utf-8");
		request.setCharacterEncoding("utf-8");
		StudentService stus = new StudentServiceImpl();
			String id = new String(request.getParameter("stuid").getBytes(
					"ISO-8859-1"), "utf-8");
			int stuid = Integer.parseInt(id);
			int n = stus.deleteStu(stuid);
			if (n == 1) {
					response.sendRedirect("StudentServlet?method=selectCon");
			} else {
				
			
		}
		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

	doGet(request, response);
	}

}
